/***************************************************************
|	File:		Matrix.h
|	Author:		Michael Mozdzierz
|	Date:		05/26/2014
|
***************************************************************/

#pragma once

struct Vector3;

#include <d3d9.h>
#include <d3d.h>
union Matrix
{
	float e[16];

	struct
	{
		float m11, m12, m13, m14,
			  m21, m22, m23, m24,
			  m31, m32, m33, m34,
			  m41, m42, m43, m44;
	};

	Matrix(void);
	Matrix(float m11, float m12, float m13, float m14, 
		   float m21, float m22, float m23, float m24, 
		   float m31, float m32, float m33, float m34, 
		   float m41, float m42, float m43, float m44);

	operator D3DMATRIX(void);
	operator const D3DMATRIX*(void);

	static Matrix CreateRotationX(float rotation);
	static Matrix CreateRotationY(float rotation);
	static Matrix CreateRotationZ(float rotation);
	 
	static Matrix Translation(Vector3 offset);
	 
	static Matrix CreateProjection(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance);
	static Matrix CreateLookAt(Vector3& cameraPosition, Vector3& cameraLookAt, Vector3& up);

	static Matrix CreateIdentity(void);
};

Matrix operator+ (Matrix&, Matrix&);
Matrix operator- (Matrix&, Matrix&);
Matrix operator* (Matrix&, Matrix&);
Vector3 operator* (Matrix&, Vector3&);
Matrix operator* (Matrix&, float);

